//
//  WmcAccountCancellationAPI.swift
//  YPWatermarkCamera
//
//  Created by 马涛 on 2022/6/23.
//

import Foundation
import RxSwift
import YPNetwork

/*
 去除签名
 */

struct WmcAccountCancellationAPI {
    
    /// 注销账号
    /// - Parameters:
    ///   - note: 说明
    ///   - images: 图片
    ///   - code: 手机验证码
    ///   - tel: 手机号
    /// - Returns: description
    static func cancelAccount(note: String,images: [String],code: String,tel: String) -> Observable<WmcCancellationResultModel> {
        /// user/member/closeAccount
        var params: [String: Any] = [String: Any]()
        params["note"] = note
        params["images"] = images
        params["code"] = code
        params["tel"] = tel
        params["clearance_agreement"] = 1
        params["confirm"] = 1
        return WmcYupaoRequest.requestData(path: "/user/member/closeAccount", parameters: params){ req in
            req.method = .post
        }.parseModelWithClass(WmcCancellationResultModel.self)
    }
    
    /// 注销账号
    /// - Parameter param: param description
    /// - Returns: description
    static func cancelAccount(param: [String: Any]) -> Observable<WmcCancellationResultModel> {
        return WmcYupaoRequest.requestData(path: "/user/member/closeAccount", parameters: param){ req in
            req.method = .post
        }.parseModelWithClass(WmcCancellationResultModel.self)
    }
    
    /// 获取验证码
    /// /index/tel_code
    /// - Parameter tel: 手机号
    /// - Returns: description
    static func sendValidationCode(tel: String) -> Observable<WmcCodeMsgRespModel> {
        var params: [String: Any] = [String: Any]()
        params["tel"] = tel
        return WmcYupaoRequest.requestData(path: "/index/tel_code", parameters: params) { req in
            req.method = .post
        }.parseModelWithClass(WmcCodeMsgRespModel.self)
    }
}
